module.exports = function (playerActioin) {
  var random = Math.random() * 3;

  if (random < 1) {
    var computerAction = "rock";
  } else if (random > 2) {
    var computerAction = "scissor";
  } else {
    var computerAction = "paper";
  }

  if (computerAction == playerActioin) {
    console.log("平局");
    return 0;
  } else if (
    (computerAction == "rock" && playerActioin == "paper") ||
    (computerAction == "scissor" && playerActioin == "rock") ||
    (computerAction == "paper" && playerActioin == "scissor")
  ) {
    console.log("你赢了");
    return -1;
  } else {
    console.log("你输了");
    return 1;
  }
}
